﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using System.Windows.Media;
using System.IO;
using System.Reflection;

namespace SimpleBomberman
{
    public class Bomberman: GameObject
    {
        #region Private Members

        private bool _deadFlag;
        private bool _isFinish;

        private bool _leftFlag;
        private bool _rightFlag;
        private bool _upFlag;
        private bool _downFlag;

        #endregion Private Members

        #region Properties

        public bool DeadFlag
        {
            get
            {
                return this._deadFlag;
            }
            set
            {
                this._deadFlag = value;
            }
        }
        public bool IsFinish
        {
            get
            {
                return this._isFinish;
            }
            set
            {
                this._isFinish = value;
            }
        }
        public bool LeftFlag
        {
            get
            {
                return _leftFlag;
            }
            set
            {
                this._leftFlag = value;
            }
        }
        public bool RightFlag
        {
            get
            {
                return _rightFlag;
            }
            set
            {
                this._rightFlag = value;
            }
        }
        public bool UpFlag
        {
            get
            {
                return _upFlag;
            }
            set
            {
                this._upFlag = value;
            }
        }
        public bool DownFlag
        {
            get
            {
                return _downFlag;
            }
            set
            {
                this._downFlag = value;
            }
        }

        #endregion Properties

        #region Constructors

        public Bomberman() : base()
        {
            this._deadFlag = false;
            this._isFinish = false;

            this._leftFlag = false;
            this._rightFlag = false;
            this._upFlag = false;
            this._downFlag = false;
        }
        public Bomberman(int x, int y, int length) : base(x, y, length)
        {
            this._deadFlag = false;
            this._isFinish = false;

            this._leftFlag = false;
            this._rightFlag = false;
            this._upFlag = false;
            this._downFlag = false;
        }

        #endregion Constructors

        #region Public Methods

        public override void Draw(Graphics g)
        {
            System.Drawing.Pen whitePen = new System.Drawing.Pen(System.Drawing.Color.White, 2);
            System.Drawing.Pen redPen = new System.Drawing.Pen(System.Drawing.Color.Red, 2);
            System.Drawing.Pen bluePen = new System.Drawing.Pen(System.Drawing.Color.Blue, 1);

            //------- White lines -------
            //--- Head ---
            g.DrawLine(whitePen, this.X + 9, this.Y + 1, this.X + 21, this.Y + 1);
            g.DrawLine(whitePen, this.X + 7, this.Y + 3, this.X + 23, this.Y + 3);

            g.DrawLine(whitePen, this.X + 8, this.Y + 4, this.X + 8, this.Y + 9);
            g.DrawLine(whitePen, this.X + 22, this.Y + 4, this.X + 22, this.Y + 9);

            g.DrawLine(whitePen, this.X + 7, this.Y + 9, this.X + 23, this.Y + 9);
            g.DrawLine(whitePen, this.X + 9, this.Y + 11, this.X + 21, this.Y + 11);

            //--- Left hand ---
            g.DrawLine(whitePen, this.X + 7, this.Y + 15, this.X + 11, this.Y + 15);
            g.DrawLine(whitePen, this.X + 5, this.Y + 17, this.X + 9, this.Y + 17);
            g.DrawLine(whitePen, this.X + 7, this.Y + 19, this.X + 9, this.Y + 19);

            //--- Right hand ---
            g.DrawLine(whitePen, this.X + 19, this.Y + 15, this.X + 23, this.Y + 15);
            g.DrawLine(whitePen, this.X + 21, this.Y + 17, this.X + 25, this.Y + 17);
            g.DrawLine(whitePen, this.X + 21, this.Y + 19, this.X + 23, this.Y + 19);

            //--- Legs ---
            g.DrawLine(whitePen, this.X + 9, this.Y + 24, this.X + 13, this.Y + 24);
            g.DrawLine(whitePen, this.X + 9, this.Y + 26, this.X + 13, this.Y + 26);

            g.DrawLine(whitePen, this.X + 17, this.Y + 24, this.X + 21, this.Y + 24);
            g.DrawLine(whitePen, this.X + 17, this.Y + 26, this.X + 21, this.Y + 26);

            //------- Red lines -------
            //--- Eyes ---
            g.DrawLine(redPen, this.X + 10, this.Y + 4, this.X + 10, this.Y + 8);

            g.DrawLine(redPen, this.X + 14, this.Y + 4, this.X + 14, this.Y + 8);
            g.DrawLine(redPen, this.X + 16, this.Y + 4, this.X + 16, this.Y + 8);

            g.DrawLine(redPen, this.X + 20, this.Y + 4, this.X + 20, this.Y + 8);

            //--- Left hand ---
            g.DrawLine(redPen, this.X + 3, this.Y + 19, this.X + 7, this.Y + 19);
            g.DrawLine(redPen, this.X + 3, this.Y + 21, this.X + 7, this.Y + 21);

            //--- Right hand ---
            g.DrawLine(redPen, this.X + 23, this.Y + 19, this.X + 27, this.Y + 19);
            g.DrawLine(redPen, this.X + 23, this.Y + 21, this.X + 27, this.Y + 21);

            //--- Legs ---
            g.DrawLine(redPen, this.X + 9, this.Y + 28, this.X + 13, this.Y + 28);
            g.DrawLine(redPen, this.X + 9, this.Y + 29, this.X + 13, this.Y + 29);

            g.DrawLine(redPen, this.X + 17, this.Y + 28, this.X + 21, this.Y + 28);
            g.DrawLine(redPen, this.X + 17, this.Y + 29, this.X + 21, this.Y + 29);

            //------- Blue lines -------
            g.FillPolygon(System.Drawing.Brushes.Blue, new Point[] { 
                new Point(this.X + 9, this.Y + 16), new Point(this.X + 11, this.Y + 16), 
                new Point(this.X + 11, this.Y + 12), new Point(this.X + 19, this.Y + 12), 
                new Point(this.X + 19, this.Y + 16), new Point(this.X + 21, this.Y + 16), 
                new Point(this.X + 21, this.Y + 23), new Point(this.X + 17, this.Y + 23), 
                new Point(this.X + 17, this.Y + 25), new Point(this.X + 13, this.Y + 25), 
                new Point(this.X + 13, this.Y + 23), new Point(this.X + 9, this.Y + 23)});
        }

        #endregion Public Methods
    }
}
